using AudioStudio;
using AudioStudio.Components;
using AudioStudio.Tools;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace com.yoozoo.gta
{
    public class AnimatorSoundEvent : MonoBehaviour
    {
        public GameObject audioEmitter;

        private void Start()
        {
            try
            {
                var audioEmitterTransform = this.transform.parent.parent.Find("AudioEmitter");
                audioEmitter = audioEmitterTransform?.gameObject;
            }catch(System.Exception e)
            {
                Debug.LogWarning("AnimatorSoundEvent Start Error: " + e.Message);
            }
           
        }
        void AttackSoundEvent()
        {
            if (audioEmitter != null)
            {
                AudioManager.PlaySound("sfx_rts_leaguemonster_attack", audioEmitter, AudioTriggerSource.EffectSound);
            }
        }

        private void OnDestroy()
        {
            audioEmitter = null;
        }
    }
}
